home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
WarriorsProgress.sit
/
Warrior’s Progress
/
source code
/
Source
/
Libraries
/
Strings
/
Numeral.h
< prev
next >
Wrap
Text File
|
1997-06-28
|
1KB
|
59 lines
// Numeral.h
#ifndef Numeral_h
#define Numeral_h
#ifndef Integers_h
#include "Integers.h"
#endif
class Numeral
{
private:
enum
{
minus = '-',
plus = '+',
none = ' '
};
uint8 *firstDigit;
uint8 sign;
bool showSign;
enum { maxLength = 66 };
uint8 digits[ maxLength ];
void MakeDigits( uint32 value, uint32 base );
uint8 Digit( uint32 n );
uint8 Sign( uint32 value );
uint8 Sign( int32 value );
void MakeDigits64( uint64 value, uint32 base );
uint8 Sign( uint64 value );
uint8 Sign( int64 value );
public:
Numeral( uint64, uint32 base = 10 );
Numeral( int64, uint32 base = 10 );
Numeral( uint32, uint32 base = 10 );
Numeral( int32, uint32 base = 10 );
Numeral( uint16, uint32 base = 10 );
Numeral( int16, uint32 base = 10 );
Numeral( uint8, uint32 base = 10 );
Numeral( int8, uint32 base = 10 );
void PadTo( uint32 digits );
void ShowSign() { showSign = true; }
uint32 DigitCount() const { return digits + maxLength - firstDigit; }
operator ConstStr255Param() const;
};
#endif